#ifndef _TYPEFACTORY_H_
#define _TYPEFACTORY_H_

#include <string.h>
#include <string>
#include <vector>
using namespace std;

#define OrderState_NotProcess      "0"
#define OrderState_WaitForProcess  "1"
#define OrderState_IsProcessing    "2"
#define OrderState_IsProcessed     "3"

#define DeviceState_Offline        "0"
#define DeviceState_Free           "1"
#define DeviceState_Wait           "2"
#define DeviceState_Busy           "3"

#define BOOL unsigned short
#define TRUE  1
#define FALSE 0

#define MESSAGE_LENGTH  100
#define USER            10001
#define DEVICE          10002

#define CURTAIN_NUMBER 16

#define SERVER_IP "120.24.100.92"
#define USER_NAME "zhangbing"
#define PASSWORD  "123456"
#define DATABASE  "MyIot"

#define ORDER_LOGIN          1
#define ORDER_CONDEV         2
#define ORDER_CURTAIN_STATE  3
#define ORDER_CURTAIN_MOVE   4

 enum
{
 orderId,       //订单编号
 ordertime,     //订单时间
 userId,        //用户Id
 userName,      //收货姓名
 phoneNumber,   //收货姓名
 recvAddress,   //收货地址
 number,        //生产木板个数
 state,         //订单状态  0 未生产  1生产完成  2正在生产
 threshold,     //阈值 cm
 length,        //长度 cm
 width,         //宽度 cm
 thickness      //厚度 cm
};

typedef struct OrderForm
{
    string strOrderID;
    string strTime;
    string strNumber;
    string strLength;
    string strWidth;
    string strThickness;
    string strThreshold;
    OrderForm();
}OrderForm;

typedef struct DeviceNode
{
   string  DeviceID;
   int     new_fd;
   BOOL    SendFlag;
   int     CurtainState[CURTAIN_NUMBER];
   string  DeviceState;
   char    Sendbuf[MESSAGE_LENGTH];
   DeviceNode();
}DeviceNode;

typedef struct UserNode
{
   int Device_NewFd;

   int DevicePosition;

   UserNode(){memset(this,0,sizeof(*this));}
}UserNode;

extern char SendOrder[20][MESSAGE_LENGTH];

#define  ORDER_LIST  vector<OrderForm>
#define  DEVICE_LIST vector<DeviceNode>

#endif // _TYPEFACTORY_H_
